<?php

include_once "function_xml_basic.php";

$root_path = "/MINI/RESOURCES/OBJECTS/TIMECLASS";

function GetXmlTimeObjectByName($name)
{
	$ret_array = GetXmlTimeObjectList();
    
        foreach ($ret_array as $ret)
        {   
                if ($ret['Name'] == $name)
                        return $ret;
        }   
        return NULL;

}

function GetXmlTimeObjectList()
{
	global $root_path;
	$query_string = $root_path. "/ATOM/OBJECT";
	$key_array = array('Name', 'ObjectType', 'TimeType', 
			   'StartTime', 'EndTime', 'Week');
	return GetAttributList($query_string, $key_array);
}

function AppendXmlTimeObject($in_array)
{
	global $root_path;
        $node_name = "OBJECT";
	$query_string = $root_path. "/ATOM";
	$in_array['ObjectType'] = "1";
	AppendAllAttrOfNode($query_string, $node_name, $in_array);
}

function SetXmlTimeObject($in_array)
{
	global $root_path;
	$name = $in_array['Name'];
	$in_array['ObjectType'] = "1";
	$query_string = $root_path. "/ATOM/OBJECT[@Name='". $name. "']";
	EditAllAttrOfNode($query_string, $in_array);
}

function DelXmlSpecialOneTimeObject($name)
{
	global $root_path;

	$query_string = $root_path. "/ATOM/OBJECT[@Name='". $name. "']";
	DelSpecialNode($query_string);
}
/*
function GetProtocolNameByNumber($number)
{
	if ($number == "6")
        	return "TCP";
        if ($number == "17")
        	return "UDP";
        if ($number == "1")
        	return "ICMP";
	return $number;
}

function GetXmlServiceObjcetNameList()
{
	$name_list = array();
	$temp_array = GetXmlServiceObjectList();
	
	$i = 0;
	foreach ($temp_array as $tmp)
	{
		$name_list[$i ++] = $tmp['Name'];
	}
	return $name_list;
}

function GetXmlServiceObjectContentList($name)
{
	$object = GetXmlServiceGroupByName($name);
	$tmp_string = $object['ObjectList'];
	$list = explode(',', $tmp_string);
	#foreach ($list as $i)
	#	print "[". $i. "]\n";
	return $list;
}

function DelXmlSpecialOneServiceObject($name)
{
	global $root_path;

	$query_string = $root_path. "/ATOM/OBJECT[@Name='". $name. "']";
	DelSpecialNode($query_string);
}

function AppendXmlServiceObject($in_array)
{
	global $root_path;
        $node_name = "OBJECT";
	$query_string = $root_path. "/ATOM";
	$in_array['ObjectType'] = "1";
	AppendAllAttrOfNode($query_string, $node_name, $in_array);
}

function SetXmlServiceObject($in_array)
{
	global $root_path;
	$name = $in_array['Name'];
	$in_array['ObjectType'] = "1";
	$query_string = $root_path. "/ATOM/OBJECT[@Name='". $name. "']";
	EditAllAttrOfNode($query_string, $in_array);
}

function GetXmlServiceGroupByName($name)
{
	$ret_array = GetXmlServiceGroupList();
    
        foreach ($ret_array as $ret)
        {   
                if ($ret['Name'] == $name)
                        return $ret;
        }   
        return NULL;

}

function GetXmlServiceGroupList()
{
	global $root_path;
	$query_string = $root_path. "/GROUP/OBJECT";
	$key_array = array('Name', 'ObjectList', 'ObjectType');
	return GetAttributList($query_string, $key_array);
}

function SetXmlServiceGroup($in_array)
{
	global $root_path;
	$in_array['ObjectType'] = "1";
	$query_string = $root_path. "/GROUP/OBJECT[@Name='". $in_array['Name']. "']";
	EditAllAttrOfNode($query_string, $in_array);
}

function DelXmlSpecialOneServiceGroup($name)
{
	global $root_path;

	$query_string = $root_path. "/GROUP/OBJECT[@Name='". $name. "']";
	DelSpecialNode($query_string);
}
*/
?>
